import { service as request } from '@/utils/request'

export function getList (data) {
    return request({
        url: `/system/user/${JSON.stringify(data)}`,
        method: 'get'
    })
}
export function doAdd (data) {
    return request({
        url: '/hawk/system/user/save',
        method: 'post',
        data
    })
}
export function doEdit (data) {
    return request({
        url: '/hawk/system/user/update',
        method: 'put',
        data
    })
}
export function doDelete (idArrays) {
    return request({
        url: `/hawk/system/user/del`,
        method: 'delete',
        data: idArrays
    })
}
export function getUserById (id) {
    return request({
        url: `/hawk/system/user/get/${id}`,
        method: 'get'
    })
}
export function getTree (id) {
    return request({
        url: `/system/user/${id}`,
        method: 'get'
    })
}

export function getAll () {
    return request({
        url: '/hawk/user/list',
        method: 'get'
    })
}

export function getRoles () {
    return request({
        url: '/hawk/system/role/get/all',
        method: 'get'
    })
}

export function chose () {
    return request({
        url: '/hawk/user/role',
        method: 'get'
    })
}


export function searchList (data) {
    return request({
        url: `/hawk/system/user/search/${data.current}/${data.size}`,
        method: 'post',
        data: data.condition
    })
}


export function getPeopleByDepartId (departmentId) {
    return request({
        url: `/hawk/department/get/sysuser/${departmentId}`,
        method: 'get'
    })
}


export function exists (data) {
    return request({
        url: `/hawk/system/user/exists?username=${data}`,
        method: "get",
        // params: {
        //     data
        // }       
    })
}

export function modifyPassword(data) {
    return request({
        url: `/hawk/system/user/modify/password`,
        method: "post",
        data: data     
    })
}
